package com.freemalll.merchant.controller;

import com.freemalll.common.core.annotation.ResultInterceptor;
import com.freemalll.merchant.domain.dto.home.MerchantHomeDto;
import com.freemalll.merchant.domain.vo.home.HomeToDoVo;
import com.freemalll.merchant.domain.vo.home.HomeTodoCountVo;
import com.freemalll.merchant.domain.vo.home.MerchantHomeVo;
import com.freemalll.merchant.service.HomeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Tag(name = "首页")
@RestController
@RequestMapping("/home")
@ResultInterceptor
@AllArgsConstructor
public class HomeController {

    private final HomeService homeService;

    @PostMapping("/list")
    @Operation(summary = "列表")
    public List<MerchantHomeVo> list(@Valid @RequestBody MerchantHomeDto dto) {
        return homeService.list(dto);
    }

    @GetMapping("/needToBeDealtWith")
    @Operation(summary = "待办列表")
    public List<HomeToDoVo> needToBeDealtWithList() {
        return homeService.needToBeDealtWithList();
    }


    @GetMapping("/needToBeDealtWithCount")
    @Operation(summary = "待办列表页签数量")
    public HomeTodoCountVo needToBeDealtWithListCount() {
        return homeService.needToBeDealtWithListCount();
    }


    @GetMapping("/alreadyDone")
    @Operation(summary = "已办列表")
    public List<HomeToDoVo> alreadyDoneList() {
        return homeService.alreadyDoneList();
    }

    @GetMapping("/alreadyDoneCount")
    @Operation(summary = "已办列表页签数量")
    public HomeTodoCountVo alreadyDoneListCount() {
        return homeService.alreadyDoneListCount();
    }

}
